package com.sto.stoapp.dataprocess.parcelable;


import android.os.Parcel;
import android.os.Parcelable;

public class SelectTableParcel implements Parcelable{

	private String code;
	private String name;
	private String property;
	private String sql;
	private static String[] sqlField;
	
	/**
	 * 设置编号
	 * @param code
	 */
	public void setSelectCode(String code){
		this.code = code;
	}
	
	/**
	 * 获取编号
	 * @return
	 */
	public String getSelectCode(){
		
		return code;
	}
	
	/**
	 * 设置名称
	 * @param code
	 */
	public void setSelectName(String name){
		this.name = name;
	}
	
	/**
	 * 获取名称
	 * @return
	 */
	public String getSelectName(){
		
		return name;
	}
	/**
	 * 获取属性
	 * @return
	 */
	public String getProperty() {
		return property;
	}

	/**
	 * 设置属性
	 * @param property
	 */
	public void setProperty(String property) {
		this.property = property;
	}
	
	/**
	 * 设置查询的sql语句
	 * @param sql
	 */
	public void setSelectSql(String sql){
		this.sql = sql;
	}
	
	/**
	 * 获取查询的sql语句
	 * @return
	 */
	public String getSelectSql(){
		return sql;
	}
	
	/**
	 * 设置查询的sql语句字段
	 * @param arg
	 */
	public void setSelectField(String[] arg){
		sqlField = arg;
	}
	
	/**
	 * 获取查询的sql语句字段
	 * @return
	 */
	public String[] getSelectField(){
		return sqlField;	
	}

	@Override
	public int describeContents() {
		
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(code);
		dest.writeString(name);
		dest.writeString(property);
		dest.writeString(sql);
		dest.writeStringArray(sqlField);
	}
	
	public static final Parcelable.Creator<SelectTableParcel> CREATOR = new Creator<SelectTableParcel>() {

		@Override
		public SelectTableParcel[] newArray(int size) {
			return new SelectTableParcel[size];
		}

		@SuppressWarnings("static-access")
		@Override
		public SelectTableParcel createFromParcel(Parcel source) {
			SelectTableParcel entity = new SelectTableParcel();
			entity.code = source.readString();
			entity.name = source.readString();
			entity.property = source.readString();
			entity.sql = source.readString();
			source.readStringArray(entity.sqlField);
			return entity;
		}
	};
}
